import Mock from 'mockjs'

const success = data => {
  return {
    code: 200,
    msg: '请求成功',
    data,
  }
}

Mock.mock(/\/public\/login/, 'post', () => {
  const payload = {
    id: 1,
    username: 'admin',
    role: 'superAdmin',
  }
  return success({
    token: `.${btoa(JSON.stringify(payload))}.`,
  })
})
